//
//  CustomizeTabBarController.m
//  07-CustomizeTabBarController
//
//  Created by 曹曹 on 16/7/23.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "CustomizeTabBarController.h"
#import "GX_TabBar.h"
#import "ViewController.h"
#import "SecondViewController.h"
#import "ForthViewController.h"
#import "FifthViewController.h"

@interface CustomizeTabBarController ()

@end

@implementation CustomizeTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setViewController:[[ViewController alloc] init] title:@"首页" image:@"tabBar_essence_icon" selectedImage:@"tabBar_essence_click_icon"];
    [self setViewController:[[SecondViewController alloc] init] title:@"消息" image:@"tabBar_new_icon" selectedImage:@"tabBar_new_click_icon"];
    [self setViewController:[[ForthViewController alloc] init] title:@"发现" image:@"tabBar_friendTrends_icon" selectedImage:@"tabBar_friendTrends_click_icon"];
    [self setViewController:[[FifthViewController alloc] init] title:@"我" image:@"tabBar_me_icon" selectedImage:@"tabBar_me_click_icon"];
    [self setValue:[[GX_TabBar alloc] init] forKeyPath:@"tabBar"];
}

- (void)setViewController:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage {
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:image];
    vc.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    vc.view.backgroundColor = [UIColor colorWithRed:arc4random_uniform(100)/100.0 green:arc4random_uniform(100)/100.0 blue:arc4random_uniform(100)/100.0 alpha:1.0];
    [self addChildViewController:vc];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
